<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>

<ui:composition 
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
    <h:head>
        
    </h:head> 
    <h:outputStylesheet>
        a.no-decor>img {
        border: none;
        }
    </h:outputStylesheet>

    <h:body rendered="true">

    <!--a4j:status onstart="#{rich:component('statPane')}.show()" onstop="#{rich:component('statPane')}.hide()" /-->
        <h1>Registro de Cursos</h1>
        <h:form prependId="false"> 
            <rich:tabPanel id="idTabcurso" switchType="client" > 
                <rich:tab header="Datos Generales">
                    <h:panelGrid columns="6">

                        <h:outputText value="Código de Asignatura:"  />
                        <h:inputText value="#{asignaturaBean.codAsignatura}" id="codigo" label="codigo"/>

                        <h:outputText value="Descripcion:" />
                        <h:inputText value="#{asignaturaBean.descAsignatura}" />

                        <h:outputText value="Area:" />
                        <h:inputText value="#{asignaturaBean.codArea}" />

                        <h:outputText value="Nivel:" />
                        <h:inputText value="#{asignaturaBean.nivel}" />

                    </h:panelGrid> 
                </rich:tab>


                <rich:panel id="sample1" styleClass="tooltip-text" bodyClass="rich-laguna-panel-no-header">

                    <h:commandButton id="btnNuevo" value="Nuevo"/>

                    <h:commandButton id="btnEditar" value="Editar"/>

                    <h:commandButton id="btnGrabar" value="Grabar"/>

                    <h:commandButton id="btnBuscar" value="Buscar"  action="busqueda"  immediate="true"/>
                
                </rich:panel>
            </rich:tabPanel>
        </h:form> 


        <a4j:jsFunction name="remove" action="#{carsBean.remove}" render="idTabAlumno" execute="@this"
                        oncomplete="#{rich:component('confirmPane')}.hide();" />

        <rich:popupPanel id="statPane" autosized="true">
            <h:graphicImage value="./images/ai.gif" alt="ai" />
            Procesando...
        </rich:popupPanel>



        <rich:popupPanel header="Edit Car Details" id="editPane" domElementAttachment="parent" width="450" height="400">
            <h:panelGrid columns="1" id="editGrid">
                <rich:dataTable value="#{carsBean.allInventoryItems}" var="car" iterationStatusVar="it" id="table" rows="15">
                    <rich:column>
                        <f:facet name="header">#</f:facet>
                            #{it.index}
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">Vendor</f:facet>
                        <h:outputText value="#{car.vendor}" />
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">Model</f:facet>
                        <h:outputText value="#{car.model}" />
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">Price</f:facet>
                        <h:outputText value="#{car.price}" />
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">Mileage</f:facet>
                        <h:outputText value="#{car.mileage}" />
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">VIN</f:facet>
                        <h:outputText value="#{car.vin}" />
                    </rich:column>
                    <rich:column>
                        <a4j:commandLink styleClass="no-decor" execute="@this" render="@none"
                                         oncomplete="#{rich:component('confirmPane')}.show()">
                            <h:graphicImage value="/images/icons/delete.gif" alt="delete" />
                            <a4j:param value="#{it.index}" assignTo="#{carsBean.currentCarIndex}" />
                        </a4j:commandLink>
                        <a4j:commandLink styleClass="no-decor" render="editGrid" execute="@this"
                                         oncomplete="#{rich:component('editPane')}.show()">
                            <h:graphicImage value="/images/icons/edit.gif" alt="edit" />
                            <a4j:param value="#{it.index}" assignTo="#{carsBean.currentCarIndex}" />
                            <f:setPropertyActionListener target="#{carsBean.editedCar}" value="#{car}" />
                        </a4j:commandLink>
                    </rich:column>
                    <f:facet name="footer">
                        <rich:dataScroller page="#{carsBean.page}" />
                    </f:facet>
                </rich:dataTable>
            </h:panelGrid>:
        </rich:popupPanel>

    </h:body>
</ui:composition>
